package com.fanrenqiji.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.math.BigDecimal;

/**
 * Created by yanwt on 2017/3/16.
 */
@Getter
@Setter
@Entity
@Table(name="tb_withdrawal")
@org.hibernate.annotations.Table(appliesTo = "tb_withdrawal",comment = "提现申请")
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate
@org.hibernate.annotations.Cache(region="withdrawal", usage = CacheConcurrencyStrategy.READ_WRITE)
public class WithdrawalEntity extends DataEntity{
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long id;

    @Column(name="business_number",columnDefinition="varchar(40) not null comment '业务单号'")
    private String businessNumber;

    @ManyToOne(fetch = FetchType.LAZY,optional = false)
    @JoinColumn(name = "company_id", insertable = false, updatable = false, columnDefinition = ("bigint(20) default null comment '公司ID'"))//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    @Where(clause = "del_flag=" + DEL_FLAG_NORMAL)
    private OfficeEntity office;

    @Column(name = "company_id", columnDefinition = ("bigint(20) not null comment '公司ID'"))
    private Long companyId;

    @Column(name="money",columnDefinition=("decimal(19,2) default null comment '款项'"))
    private BigDecimal money;

    @Column(name="status",columnDefinition="int(1) not null comment '状态:-1:取消,0:新建,1:完成'")
    private int status;

    @Column(columnDefinition="text not null comment '业务描述'")
    private String description;

}
